<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMiniProgramTemplateCommitRecordsTable extends Migration {
    /**
     * Run the migrations.
     * @return void
     */
    public function up() {
        Schema::create('mini_program_template_commit_records', function (Blueprint $table) {
            $table->increments('id')->comment('表备注：上传小程序代码记录表');
            $table->dateTime('create_time')->comment('开发者上传草稿时间戳');
            $table->string('user_version', 50)->comment('版本号,开发者自定义字段');
            $table->string('user_desc', 50)->comment('版本描述,开发者自定义字段');
            $table->string('wx_template_id')->comment('微信模板id');
            $table->integer('mpt_id')->comment('本地微信模板信息表id');
            $table->integer('app_project_id')->comment('对应的项目表app_projects关联id');
            $table->integer('user_id')->comment('操作用户id');
            $table->string('remark')->default('')->comment('备注');
    
            $table->dateTime('created_at')->nullable()->default(null);
            $table->dateTime('updated_at')->nullable()->default(null);
            $table->tinyInteger('deleted')->default(0)->comment('是否删除,1:是,0:否');
            
            $table->index(['user_id']);
        });
    }
    
    /**
     * Reverse the migrations.
     * @return void
     */
    public function down() {
        Schema::dropIfExists('mini_program_template_commit_records');
    }
}
